package threadtest;

public class TB implements Runnable {

	String content;
	Object outer;
	Object inner;
	static int sum = 100;

	public TB(String content, Object outer, Object inner) {
		super();
		this.content = content;
		this.outer = outer;
		this.inner = inner;
	}

	@Override
	public void run() {
		int now = 1;
		int limit = 10;

		while (now<limit) {
			synchronized (outer) {
				synchronized (inner) {
					System.err.println(content + ":" + sum--);
					inner.notify();
				}
				boolean a = false;
				if (a) {
					outer.notify();
				} else {
					try {
						if (now < limit) {
							outer.wait();
						}
					} catch (InterruptedException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			}
		}
	}

}
